#include "AT_Command.h"

extern UART_HandleTypeDef UART5_Handler;

void WiFi_Init(void){
	
	HAL_UART_Transmit(&UART5_Handler,"AT\r\n",strlen("AT\r\n"),100);
	delay_ms(100);
	HAL_UART_Transmit(&UART5_Handler,"AT+CWMODE=1\r\n",strlen("AT+CWMODE=1\r\n"),100);
	delay_ms(500);
	HAL_UART_Transmit(&UART5_Handler,"AT+CWJAP=\"Redmi K70\",\"a7777777\"\r\n",strlen("	AT+CWJAP=\"Redmi K70\",\"a7777777\"\r\n"),100);
	delay_ms(11000);
	
	HAL_UART_Transmit(&UART5_Handler,"AT+CIPSTART=\"TCP\",\"192.168.128.4\",8087\r\n",strlen("AT+CIPSTART=\"TCP\",\"192.168.128.4\",8087\r\n"),100);
	delay_ms(5000);

	HAL_UART_Transmit(&UART5_Handler,"AT+CIPMODE=1\r\n",strlen("AT+CIPMODE=1\r\n"),100);
	delay_ms(5000);

		HAL_UART_Transmit(&UART5_Handler,"AT+CIPMODE=1\r\n",strlen("AT+CIPMODE=1\r\n"),100);
	delay_ms(5000);
	
			HAL_UART_Transmit(&UART5_Handler,"	AT+CIPSEND\r\n",strlen("	AT+CIPSEND\r\n"),100);
	delay_ms(500);
}
